import { defHttp } from '@/utils/http/axios'

enum Api {
  CHEMICAL_EXHAUST_TABLE_HEADER = '/gas/chemical/exhaust/header',
  CHEMICAL_EXHUAUST_PAGE_LIST = '/gas/chemical/exhaust/selectPage',
  CHEMICAL_EXHAUST_ADD_RECORD = '/gas/chemical/exhaust/addOrUpdate',
  CHEMICAL_EXHAUST_DELETE_RECORD = '/gas/chemical/exhaust/delete',
  CHEMICAL_EXHAUST_IMPORT_DATA = '/gas/chemical/exhaust/import/excel',
  GAS_CHEMICAL_EXPORT_TEMPLATE = '/gas/chemical/exhaust/export/template',

  GAS_CONSUMPTION_HEADER = '/gas/consumption/header',
  GAS_CONSUMPTION_ADDORUPDATE = '/gas/consumption/addOrUpdate',
  GAS_CONSUMPTION_DELETE = '/gas/consumption/delete',
  GAS_CONSUMPTION_PAGE_LIST = '/gas/consumption/selectPage',
  GAS_CONSUMPTION_IMPORT_DATA = '/gas/consumption/import/excel',
  GAS_CONSUMPTION_EXPORT_TEMPLATE = '/gas/consumption/export/template',

  GAS_SNY_GAS_PLANNUMDATASYN = '/gas/syn/gas/planNumDataSyn', //化学品同步
  GAS_SNY_CHEMICALS_PLANNUMDATASYN = '/gas/syn/chemicals/planNumDataSyn', //天然气同步
  GAS_SNY_TGM_PLANNUMDATASYN = '/tgm/consumption/gas/planNumDataSyn', //特气库同步
  GAS_SNY_CCSS_PLANNUMDATASYN = '/ccss/consumption/gas/planNumDataSyn', //CCSS同步
}

// exhaust gas
export const getChemicalTableHeader = (params: { parentClassifyId: string }) =>
  defHttp.get({ url: Api.CHEMICAL_EXHAUST_TABLE_HEADER, params })

export const getChemicalDelete = (params: { id: string }) =>
  defHttp.get({ url: Api.CHEMICAL_EXHAUST_DELETE_RECORD, params })

export const postChemicalTableData = (data: any) =>
  defHttp.post({ url: Api.CHEMICAL_EXHUAUST_PAGE_LIST, data })

export const postAddOrUpdateChemicalTableRecord = (data: any) =>
  defHttp.post({ url: Api.CHEMICAL_EXHAUST_ADD_RECORD, data })

export const postChemicalFileImport = (data: any) =>
  defHttp.post({
    url: Api.CHEMICAL_EXHAUST_IMPORT_DATA,
    data,
    headers: { 'Content-Type': 'multipart/form-data' },
  })

// natural gas
export const getNaturalTableHeader = (params: { parentClassifyId: string }) =>
  defHttp.get({ url: Api.GAS_CONSUMPTION_HEADER, params })

export const getNaturalDelete = (params: { id: string }) =>
  defHttp.get({ url: Api.GAS_CONSUMPTION_DELETE, params })

export const postNaturalTableData = (data: any) =>
  defHttp.post({ url: Api.GAS_CONSUMPTION_PAGE_LIST, data })

export const postAddOrUpdateNaturalTableRecord = (data: any) =>
  defHttp.post({ url: Api.GAS_CONSUMPTION_ADDORUPDATE, data })

export const postNatrualFileImport = (data: any) =>
  defHttp.post({
    url: Api.GAS_CONSUMPTION_IMPORT_DATA,
    data,
    headers: { 'Content-Type': 'multipart/form-data' },
  })

export const getGasExportTemplate = () =>
  defHttp.get({ url: Api.GAS_CHEMICAL_EXPORT_TEMPLATE, responseType: 'blob' })

export const getNaturalExportTemplate = () =>
  defHttp.get({ url: Api.GAS_CONSUMPTION_EXPORT_TEMPLATE, responseType: 'blob' })
export const getplanNumDataSyn = (data: any) =>
  defHttp.post({ url: Api.GAS_SNY_CHEMICALS_PLANNUMDATASYN, data })

export const getGasplanNumDataSyn = (data: any) =>
  defHttp.post({ url: Api.GAS_SNY_GAS_PLANNUMDATASYN, data })

export const getTgmplanNumDataSyn = (data: any) =>//特气库同步
  defHttp.post({ url: Api.GAS_SNY_TGM_PLANNUMDATASYN, data })

  export const getCcssplanNumDataSyn = (data: any) =>//CCSS同步
  defHttp.post({ url: Api.GAS_SNY_CCSS_PLANNUMDATASYN, data })
